classPolicy
final class Policy
Restricted visibility: declared "@visibility SqlFormatter". Code outside that scope must not name this declaration.
Whitespace and alignment decisions for one nested block.
Properties§
public FormatOptions $optionspublic int $basepublic int $widthMethods§
public function __construct(public FormatOptions $options, public int $base, public int $width)Uses a width calculated from the headers in this block only.
Parameters
$options | FormatOptions | |
$base | int | |
$width | int |
public function line(int $indent): stringStarts a line at a column, or separates compact tokens.
Parameters
$indent | int |
Returns
stringTest cases 1
Called from 7
- method-call SqlFormatter\Core\Layout\Block::render() packages/sql-formatter/src/Core/Layout/Block.php:33
- method-call SqlFormatter\Core\Layout\Elements::write() packages/sql-formatter/src/Core/Layout/Elements.php:32
- method-call SqlFormatter\Core\Layout\Elements::write() packages/sql-formatter/src/Core/Layout/Elements.php:35
- method-call SqlFormatter\Core\Layout\Elements::write() packages/sql-formatter/src/Core/Layout/Elements.php:43
- method-call SqlFormatter\Core\Layout\Elements::write() packages/sql-formatter/src/Core/Layout/Elements.php:46
- method-call SqlFormatter\Core\Layout\Policy::beforeHeader() packages/sql-formatter/src/Core/Layout/Policy.php:37
- method-call SqlFormatter\Core\Layout\Policy::afterHeader() packages/sql-formatter/src/Core/Layout/Policy.php:46
Calls 1
- function-call
str_repeatline 29
public function beforeHeader(int $length): stringAligns the beginning of a header within this block.
Parameters
$length | int |
Returns
stringTest cases 1
Called from 2
Calls 3
- method-call Policy::line() line 37
- class-const Style::River() line 37
- function-call
maxline 37
public function afterHeader(int $length): stringPlaces the body below or beside its header.
Parameters
$length | int |
Returns
stringTest cases 2
Called from 2
Calls 8
- class-const Style::Expanded() line 46
- method-call Policy::line() line 46
- method-call Policy::bodyIndent() line 46
- class-const Style::Tabular() line 47
- function-call
str_repeatline 47 - function-call
maxline 47 - class-const Style::Compact() line 48
- class-const Style::River() line 48
public function bodyIndent(): intAnswers the column where list items continue.
Returns
intTest cases 2
Called from 2
Calls 1
- class-const Style::Expanded() line 57
Test cases 14§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 4
Other tests reaching this symbol 10
SettingsTestcallsFormatterTestcallsBlockTestcallsElementsTestcallsHeadersTest::testWriteAlignsRiverHeadercallsRendererTestcallsFormatterTestcallsDialectTestcallsDialectTestcallsDialectTestcalls
Relations§
Instantiated in 1
Method calls 10
- method-call SqlFormatter\Core\Layout\Block::render() packages/sql-formatter/src/Core/Layout/Block.php:33
- method-call SqlFormatter\Core\Layout\Block::render() packages/sql-formatter/src/Core/Layout/Block.php:38
- method-call SqlFormatter\Core\Layout\Block::render() packages/sql-formatter/src/Core/Layout/Block.php:39
- method-call SqlFormatter\Core\Layout\Elements::write() packages/sql-formatter/src/Core/Layout/Elements.php:32
- method-call SqlFormatter\Core\Layout\Elements::write() packages/sql-formatter/src/Core/Layout/Elements.php:32
- method-call SqlFormatter\Core\Layout\Elements::write() packages/sql-formatter/src/Core/Layout/Elements.php:35
- method-call SqlFormatter\Core\Layout\Elements::write() packages/sql-formatter/src/Core/Layout/Elements.php:43
- method-call SqlFormatter\Core\Layout\Elements::write() packages/sql-formatter/src/Core/Layout/Elements.php:46
- method-call SqlFormatter\Core\Layout\Elements::write() packages/sql-formatter/src/Core/Layout/Elements.php:48
- method-call SqlFormatter\Core\Layout\Headers::write() packages/sql-formatter/src/Core/Layout/Headers.php:61